const AgencyModel = require('../db/models/agencyInfo');
//import model


class AgencyInfoServer {
  async addAgencyInfoData (data) {
    //检查cid是否存在 check cid is existed
    const id = 1;
    const result = await AgencyModel.findOne({where: { id }});
    //判断 check
    if (result) {
      //更新 update
      return await AgencyModel.update(data, {where: { id }})
    }else {
      //创建 create
      return await AgencyModel.create(data);
    }
  }
}

module.exports = new AgencyInfoServer();